package com.coincalf.feign;


import com.coincalf.dto.CoinDTO;
import com.coincalf.dto.CoinInfoDto;
import com.coincalf.feign.hystrix.CoinServiceClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * 币种信息获取
 * by crow
 * 2018年5月19日14:38:00
 */
@FeignClient(value = "coincalf-service", fallback = CoinServiceClientFallback.class)
public interface CoinServiceClient {

    /**
     * 获取数字货币coin 初始化数字货币账户
     */
    @RequestMapping(value = "/coin/trade", method = RequestMethod.GET)
    List<CoinDTO> selectCoinInfo();

    /**
     * 获取创新交易coin 初始化创新交易账户
     */
    @RequestMapping(value = "/coin/forex", method = RequestMethod.GET)
    List<CoinDTO> selectForexCoin();

    /**
     * 获取币种RPC SERVER URL
     */
    @RequestMapping(value = "/coin/serverUrl/{coinName}", method = RequestMethod.GET)
    String selectRpcServerUrl(@PathVariable("coinName") String coinName);

    /**
     * 获取币种及其主链币种信息
     */
    @RequestMapping(value = "/coin/info/{coinName}", method = RequestMethod.GET)
    CoinInfoDto selectCoinInfo(@PathVariable("coinName") String coinName);

    /**
     * 查询所有主链币种
     */
    @RequestMapping(value = "/coin/mainCoins", method = RequestMethod.GET)
    List<CoinInfoDto> selectAllMainCoin();

    /**
     * 根据币种id获取币种信息
     */
    @RequestMapping(value = "/coin/contract/{coinId}", method = RequestMethod.GET)
    List<CoinInfoDto> selectCoinInfoByMainCoinId(@PathVariable("coinId") Long coinId);

    //根据币种id查询主链币种id
    @RequestMapping(value = "/coin/mainCoinId/{coinId}", method = RequestMethod.GET)
    Long selectMainCoinIdByCoinId(@PathVariable("coinId") Long coinId);
}
